package com.errol.batchprocessor.employeeaddition.advisorimpl;

import lombok.Getter;

/**
 * 员工导入添加扩展
 *
 * @author zhang xiao bin
 * @version v1.0
 * @date 2021/02/22
 * @since v5.0.5
 **/
@Getter
public enum EmployeeAdvisorTypeEnum {

    /**
     * 人员导入扩展类型，code >0 为导入，<0 为编辑
     */
    EMPLOYEE_LIST(1, "人员列表导入扩展"),
    EMPLOYEE_LIST_MANAGE(-1, "人员列表新增或编辑扩展"),
    DEMAND_EMPLOYEE(2, "接单导入扩展"),
    DEMAND_EMPLOYEE_MANAGE(-2, "接单导入新增或编辑扩展"),
    PAYROLL_RECORD(3, "发放导入扩展"),
    PAYROLL_RECORD_MANAGE(-3, "发放导入新增或编辑扩展"),
    PAYROLL_RECORD_TEST(4, "发放导入压测扩展"),
    ;

    private final Integer code;
    private final String desc;

    EmployeeAdvisorTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static EmployeeAdvisorTypeEnum resolve(Integer code) {
        for (EmployeeAdvisorTypeEnum value : EmployeeAdvisorTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
